//
// Created by none98 on 2021/9/10.
//

#include <spdlog/spdlog.h>
#include "Channel.h"
#include "Selector.h"


void Channel::HandleEvents() {
    if(activeEvents & Selector::READ){
        if(readCallBack){
            readCallBack();
        }else{
            spdlog::error("readCallBack is empty in Sockt: {}", fd);
        }
    }

    if(activeEvents & Selector::WRITE){
        if(writeCallBack){
            writeCallBack();
        }else{
            spdlog::error("writeCallBack is empty in Sockt: {}",fd);
        }
    }

    if(activeEvents & Selector::ERROR){
        if(errorCallBack){
            errorCallBack();
        }else{
            spdlog::error("errorCallBack is empty in Sockt: {}", fd);
        }
    }
}